package com.xiyun.easyapi.controller;


import com.xiyun.easyapi.config.util.Res;
import com.xiyun.easyapi.controller.request.SQLReq;
import com.xiyun.easyapi.service.SQLService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "SQL管理")
@RestController
@RequestMapping("pt/sql")
public class SQLController {

    @Autowired
    private SQLService service;

    /**
     * 执行sql
     *
     * @return .
     */
    @Operation(summary = "执行sql")
    @PostMapping("/execute")
    public Res<?> execute(@RequestBody @Validated SQLReq.execute param) {
        return service.execute(param);
    }
}
